package com.cszjzx.member.dao;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;

public class MembercodeDAOImpl implements MembercodeDAO{
	private JdbcHelper helper;
	public MembercodeDAOImpl() throws IOException{
		helper=new JdbcHelper();
	}
	public String[] getStartAndStop() throws ClassNotFoundException, SQLException, IOException {
		String sql="select * from membercode";
		Object[]args={};
		return (String[]) helper.executeQuery(sql, args, new RowMapper() {
			public Object mapRow(ResultSet rs) throws SQLException, ClassNotFoundException, IOException {
                String [] strings=new String[2];
                strings[0]=rs.getString(1);
                strings[1]=rs.getString(2);
				return strings;
			}
		}).get(0);
	}
	
	public void update(String start,String stop) throws SQLException{
		String sql = "update membercode set startValue = ?,stopValue = ?";
		Object [] args={start,stop};
		helper.executeUpdate(sql, args);
	}
	
	public static void main(String[] args) throws ClassNotFoundException, SQLException, IOException {
		/*String[] string =new MembercodeDAOImpl().getStartAndStop();
		for(int i=0;i<string.length;i++){
			System.out.println(string[i]);
		}*/
	}
}
